// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) UXBOX Labs SL

.dashboard-sidebar {
  background-color: $color-white;

  .sidebar-inside {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-top: $size-2;
  }

  .sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 0;

    hr {
      border-color: $color-gray-10;
      margin: 1rem 15px;
    }
  }

  .sidebar-team-switch {
    position: relative;
    display: flex;
    margin: 5px 15px;

    .teams-dropdown {
      left: 0;
      top: 50px;
      z-index: 12;
      max-height: 30rem;
      min-width: 230px;
      overflow-y: auto;
    }

    .options-dropdown {
      right: 2px;
      top: 50px;
      z-index: 12;
      max-height: 30rem;
      min-width: 162px;
    }

    .switch-content {
      height: 40px;
      display: flex;
      width: 100%;
      border: 1px solid $color-gray-10;
      border-radius: $br-medium;
      align-items: center;
    }

    .switch-options {
      display: flex;
      max-width: 22px;
      min-width: 28px;
      border-left: 1px solid $color-gray-10;
      justify-content: center;
      align-items: center;
      cursor: pointer;

      svg {
        width: 15px;
        height: 13px;
        fill: $color-gray-60;
      }
    }

    .current-team {
      cursor: pointer;
      display: flex;
      flex-grow: 1;
      font-size: $fs14;
      padding: 0px 10px;
    }

    .team-name {
      flex-grow: 1;
      display: flex;
      height: 48px;
      align-items: center;

      .team-icon {
        display: flex;
        align-items: center;
        padding-right: 10px;

        svg {
          width: 23px;
          height: 23px;
          fill: $color-gray-60;
        }

        img {
          border-radius: 50%;
          flex-shrink: 0;
          height: 23px;
          width: 23px;
        }
      }

      .team-text {
        color: $color-gray-60;
        @include text-ellipsis;
        width: 130px;
      }
    }

    .switch-icon {
      display: flex;
      align-items: center;

      svg {
        width: 10px;
        height: 10px;
        fill: $color-gray-60;
      }
    }
  }

  .sidebar-empty-placeholder {
    padding: 10px 12px;
    color: $color-gray-30;
    display: flex;
    align-items: flex-start;

    .icon {
      padding: 0px 10px;
      svg {
        fill: $color-gray-30;
        width: 12px;
        height: 12px;
      }
    }
    .text {
      font-size: $fs12;
    }
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin: 0;

    // TODO: should be deprecated / unclear name
    &.dashboard-common {
      overflow: unset;
    }

    &.no-overflow {
      overflow: unset;
    }

    & > li {
      align-items: center;
      cursor: pointer;
      display: flex;
      flex-shrink: 0;
      padding: $size-2;

      svg {
        fill: $color-black;
        margin-right: 8px;
        height: $size-3;
        width: $size-3;
      }

      span.element-title {
        color: $color-gray-60;
        font-size: $fs14;
        overflow-x: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        user-select: none;
      }

      &::before {
        background-color: transparent;
        border-radius: $br-small;
        content: "";
        height: 26px;
        margin-right: $size-2;
        width: 4px;
      }

      &.recent-projects {
        svg {
          fill: $color-white;
        }
      }

      & .edit-wrapper {
        border: 1px solid $color-gray-10;
        border-radius: $br-small;
        display: flex;
        width: 100%;
      }

      input.element-title {
        border: 0;
        height: 30px;
        padding: 5px;
        margin: 0;
        width: 100%;
        background-color: $color-white;
      }

      .close {
        background-color: $color-white;
        cursor: pointer;
        padding: 3px 5px;

        svg {
          fill: $color-gray-30;
          height: 15px;
          transform: rotate(45deg) translateY(7px);
          width: 15px;
          margin: 0;
        }
      }

      .element-subtitle {
        color: $color-gray-20;
        font-style: italic;
      }

      &:hover {
        &::before {
          background-color: $color-gray-10;
        }
      }

      &.current {
        font-weight: bold;

        &::before {
          background-color: $color-primary;
        }
      }

      &.dragging {
        background-color: color.adjust($color-primary, $alpha: -0.69);
      }
    }
  }

  .sidebar-search {
    align-items: center;
    background-color: $color-white;
    border: 1px solid $color-gray-10;
    border-radius: $br-medium;
    display: flex;
    margin: 5px 15px;

    .input-text {
      background: transparent;
      border: 0;
      color: $color-gray-60;
      font-size: $fs14;
      padding: 6px;
      margin: 0;
      max-width: 195px;
      width: 100%;
      height: 40px;
    }

    &:focus,
    &:focus-within {
      border-color: $color-black;
    }

    .search,
    .clear-search {
      align-items: center;
      cursor: pointer;
      display: flex;
      height: 22px;
      margin-left: auto;
      padding: 0 $size-2;
      width: 32px;

      svg {
        fill: $color-gray-30;
        height: 15px;
        width: 15px;

        &:hover {
          fill: $color-danger;
        }
      }
    }

    .clear-search svg {
      transform: rotate(45deg);
    }
  }

  &.profile-bar {
    background-color: $color-gray-10;

    .dashboard-sidebar-inside {
      display: none;
    }
  }
}

.projects-row {
  align-items: center;
  display: flex;
  margin-top: 1rem;
  padding: $size-2;
  position: relative;

  span {
    color: $color-gray-30;
    font-size: $fs14;
  }

  .btn-icon-light {
    margin-left: auto;
  }

  &::before {
    background-color: $color-gray-10;
    content: "";
    height: 1px;
    left: 4%;
    position: absolute;
    right: 4%;
    top: -5px;
    width: 92%;
  }
}

.team-form-modal {
  h2 {
    font-weight: 400;
    color: $color-gray-40;
    font-size: 28px;
    margin-bottom: 30px;
  }

  .buttons-row {
    margin-top: 20px;
    display: flex;
    justify-content: center;
  }

  input[type="submit"] {
    margin-bottom: 0px;
  }
}

.profile-section {
  align-items: center;
  cursor: pointer;
  display: flex;
  padding: 10px 15px;
  position: relative;

  .profile {
    align-items: center;
    cursor: pointer;
    display: flex;
    flex-grow: 1;

    span {
      @include text-ellipsis;
      color: $color-black;
      margin: 10px 5px;
      font-size: $fs14;
      max-width: 160px;
    }

    img {
      border-radius: 50%;
      flex-shrink: 0;
      height: 25px;
      width: 25px;
    }
    svg {
      height: 10px;
      margin-left: auto;
      margin-right: $size-2;
      width: 10px;
    }
  }

  .dropdown {
    left: 15px;
    bottom: 45px;
    min-width: 189px;

    @include animation(0, 0.2s, fadeInUp);

    li {
      height: 32px;
      font-size: $fs14;
      padding: 5px 10px;

      svg {
        fill: $color-gray-20;
        margin-right: $size-2;

        height: 12px;
        width: 12px;
      }

      &.separator {
        border-top: 1px solid $color-gray-10;
      }
    }
  }
}

.primary-badge {
  border: 1px solid $color-primary;
  border-radius: 2px;
  font-size: $fs9 !important;
  font-weight: bold;
  color: $color-primary !important;
  padding: 2px 4px;
}
